from pydantic import BaseModel
from pydantic import ConfigDict
from typing import Optional

class ItemBase(BaseModel):
    title: str
    description: Optional[str] = None

class ItemCreate(ItemBase):
    pass

class ItemRead(ItemBase):
    id: int
    # Pydantic v2: use model_config with ConfigDict(from_attributes=True)
    model_config = ConfigDict(from_attributes=True)
